package com.ap.core.business.message.validation.info.impl;

import com.ap.core.common.types.InputMessageType;
import com.ap.core.common.types.MessageStatus;
import com.ap.core.cxf.jaxb.common.DeliveryType;
import com.ap.core.cxf.jaxb.msghdr.MessageType;
import com.ap.core.cxf.jaxb.rtp.TransactionCheckOutType;
import com.ap.core.domain.OrderPayment;
import com.ap.core.validation.message.info.RTPOriginalInfo;
import org.joda.time.LocalDateTime;

/**
 * User: Ranjit.Singh
 */
public class RTPOriginalInfoImpl implements RTPOriginalInfo {

    private final OrderPayment orderPayment;

    public RTPOriginalInfoImpl(OrderPayment orderPayment) {
        this.orderPayment= orderPayment;
    }

    @Override
    public MessageType getOriginalMessageType() {
        return null == orderPayment ? null :orderPayment.getInputMessageType().getInputMsgTypeEnum();
    }

    @Override
    public boolean isOrderPaymentExists(MessageStatus msgStatus) {
        return null != orderPayment && msgStatus == orderPayment.getStatusCode();
    }

    @Override
    public LocalDateTime getRetrievalExpiryTime() {
        return null == orderPayment ? null :orderPayment.getRetrievalExpiryTimeStmp();
    }

    @Override
    public TransactionCheckOutType getTransactionCheckOutType() {
        return null == orderPayment ? null :orderPayment.getTransactionCheckoutType();
    }

    @Override
    public DeliveryType getDeliveryType() {
        return null == orderPayment ? null : orderPayment.getDeliveryType();
    }

	@Override
	public boolean isOrderPaymentExists() {
		return null != orderPayment;
	}

	@Override
	public String getOriginalAPTrId() {
		return null == orderPayment ? null : String.valueOf(orderPayment.getApTransactionRetrievalId());
	}
	
	@Override
	public String getOriginalAPTxnId() {
		return null == orderPayment ? null : String.valueOf(orderPayment.getApTransactionId());
	}
	
	

	@Override
	public LocalDateTime getReconCutoffEndTime() {
		return null == orderPayment ? null :orderPayment.getReconCutoffEndTimeStmp();
	}

	@Override
	public InputMessageType getOriginalInputMessageType() {
		return null == orderPayment ? null :orderPayment.getInputMessageType();
	}
	
	
}
